package com.aiyige.page.publish.normalvideo.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.page.interest.model.Interest;
import com.aiyige.page.publish.guarantee.model.GuaranteeItem;
import com.aiyige.page.publish.selectcoursetype.model.CourseTypeItem;
import com.aiyige.page.publish.selectinterest.model.PublishIndustryItem;
import com.aiyige.page.publish.selectinterest.model.PublishInterestItem;
import com.aiyige.page.publish.selectlearntarget.model.SelectLearnTargetItem;
import com.aiyige.page.publish.selectsuitablepeople.model.SelectSuitablePeopleItem;
import com.aiyige.page.publish.selecttag.model.SelectTagItem;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by zhuyakun on 2017/11/14.
 */

public class PublishNormalVideoFormModel implements Parcelable {
    String title;
    String coverUrl;
    List<Interest> interestList;
    List<Interest> industryList;
    String courseIntroduction;
    List<PublishNormalVideoItem> publishNormalVideoItemList;

    public PublishNormalVideoFormModel() {
    }

    private PublishNormalVideoFormModel(Builder builder) {
        setTitle(builder.title);
        setCoverUrl(builder.coverUrl);
        setInterestList(builder.interestList);
        setIndustryList(builder.industryList);
        setCourseIntroduction(builder.courseIntroduction);
        setPublishNormalVideoItemList(builder.publishNormalVideoItemList);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    public List<Interest> getInterestList() {
        return interestList;
    }

    public void setInterestList(List<Interest> interestList) {
        this.interestList = interestList;
    }

    public List<Interest> getIndustryList() {
        return industryList;
    }

    public void setIndustryList(List<Interest> industryList) {
        this.industryList = industryList;
    }

    public String getCourseIntroduction() {
        return courseIntroduction;
    }

    public void setCourseIntroduction(String courseIntroduction) {
        this.courseIntroduction = courseIntroduction;
    }

    public List<PublishNormalVideoItem> getPublishNormalVideoItemList() {
        return publishNormalVideoItemList;
    }

    public void setPublishNormalVideoItemList(List<PublishNormalVideoItem> publishNormalVideoItemList) {
        this.publishNormalVideoItemList = publishNormalVideoItemList;
    }

    public static final class Builder {
        private String title;
        private String coverUrl;
        private List<Interest> interestList;
        private List<Interest> industryList;
        private String courseIntroduction;
        private List<PublishNormalVideoItem> publishNormalVideoItemList;

        private Builder() {
            title = "";
            coverUrl = "";
            interestList = new LinkedList<>();
            industryList = new LinkedList<>();
            courseIntroduction = "";
            publishNormalVideoItemList = new LinkedList<>();
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder coverUrl(String val) {
            coverUrl = val;
            return this;
        }

        public Builder interestList(List<Interest> val) {
            interestList = val;
            return this;
        }

        public Builder industryList(List<Interest> val) {
            industryList = val;
            return this;
        }

        public Builder courseIntroduction(String val) {
            courseIntroduction = val;
            return this;
        }

        public Builder publishNormalVideoItemList(List<PublishNormalVideoItem> val) {
            publishNormalVideoItemList = val;
            return this;
        }

        public PublishNormalVideoFormModel build() {
            return new PublishNormalVideoFormModel(this);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeString(this.coverUrl);
        dest.writeTypedList(this.interestList);
        dest.writeTypedList(this.industryList);
        dest.writeString(this.courseIntroduction);
        dest.writeTypedList(this.publishNormalVideoItemList);
    }

    protected PublishNormalVideoFormModel(Parcel in) {
        this.title = in.readString();
        this.coverUrl = in.readString();
        this.interestList = in.createTypedArrayList(Interest.CREATOR);
        this.industryList = in.createTypedArrayList(Interest.CREATOR);
        this.courseIntroduction = in.readString();
        this.publishNormalVideoItemList = in.createTypedArrayList(PublishNormalVideoItem.CREATOR);
    }

    public static final Creator<PublishNormalVideoFormModel> CREATOR = new Creator<PublishNormalVideoFormModel>() {
        @Override
        public PublishNormalVideoFormModel createFromParcel(Parcel source) {
            return new PublishNormalVideoFormModel(source);
        }

        @Override
        public PublishNormalVideoFormModel[] newArray(int size) {
            return new PublishNormalVideoFormModel[size];
        }
    };
}
